package com.lg.system.interceptor;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class CustomInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        // 在请求处理之前进行调用
        System.out.println("CustomInterceptor preHandle");
        // 如果返回false，则停止流程，api不会被调用
        // 如果返回true，则继续流程，调用下一个拦截器，若没有更多拦截器，则调用API方法
        return true;
    }
}